import http from '@/utils/request'

//  登录的接口
export function loginRequest (loginData) {
    return http({
        url:'/user/login',
        method:'post',
        data:loginData
    })
}

//  查询所有用户的接口
export function getAllUserRequest (currentPage,pageSize) {
    return http({
        url:'/user',
        method:'get',
        data:{},
        params:{currentPage,pageSize}
    })
}

//  添加用户的接口
export function addUserRequest (addUserData) {
    return http({
        url:'/user',
        method:'post',
        data:addUserData
    })
}

//  删除用户的接口
export function deleteUserRequest (id) {
    return http({
        url:`/user/${id}`,
        method:'delete',
        data:''
    })
}

//  根据id查询用户的接口
export function getUserByIdRequest (id) {
    return http({
        url:`/user/${id}`,
        method:'get',
        data:''
    })
}

//  更新用户的接口
export function updateUserRequest (updateUserData) {
    return http({
        url:'/user',
        method:'put',
        data:updateUserData
    })
}

//  根据id修改用户状态的接口
export function updateUserStatusRequest (id,status) {
    return http({
        url:'/user/updateUserStatusRequest',
        method:'get',
        data:{},
        params:{
            id,status
        }
    })
}

//  根据用户名查询用户信息的接口
export function getUserByNameRequest (searchName) {
    return http({
        url:'/user/searchUserByName',
        method:'get',
        data:{},
        params:{
            searchName
        }
    })
}